<?php 

include("yeepay/yeepayMPay.php");
include("config.php");

$yeepay = new yeepayMPay($merchantaccount,$merchantPublicKey,$merchantPrivateKey,$yeepayPublicKey);


	
	$order_id = create_str(15);                      //客户订单号
	$transtime = time();                                                          //交易时间
	$product_catalog ='1';   //商品类别码
	$identity_id = '2344442err233';           //支付身份标识
	$identity_type = 0;     //支付身份标识类型码
 	$user_ip = '116.228.90.38';         
 	$user_ua = 'NokiaN70/3.0544.5.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1';                            //用户ua
    $callbackurl ='http://mobiletest.yeepay.com/apidemo/pay/callback';           //商户后台系统回调地址，前后台的回调结果一样
    $fcallbackurl ='http://mobiletest.yeepay.com/apidemo/pay/callback';           //商户前台系统回调地址，前后台的回调结果一样
	$product_name = 'test';        //商品名称
	$product_desc = 'test';        //商品描述
	$other = 'ergrttth245345.4565.33434';                           //其他支付身份信息
	$amount =4;		                  //交易金额
				
	$url = $yeepay->pcWebPay($order_id,$transtime,$amount,$product_catalog,$identity_id,$identity_type,$user_ip,$user_ua,$terminal_type='',$terminal_id='',$paytypes='1|2',$orderexp_date=60,$callbackurl,$fcallbackurl,$currency=156,$product_name,$product_desc,$other);

 	$arr = explode("&",$url);
 	$encrypt = explode("=",$arr[1]);
 	$data = explode("=",$arr[2]); 
 		
	
	var_dump($url);	


function create_str( $length = 8 ) {  
// 密码字符集，可任意添加你需要的字符  
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';  
$str = '';  
for ( $i = 0; $i < $length; $i++ )  
{  
// 这里提供两种字符获取方式  
// 第一种是使用 substr 截取$chars中的任意一位字符；  
// 第二种是取字符数组 $chars 的任意元素  
// $password .= substr($chars, mt_rand(0, strlen($chars) – 1), 1);  
$str .= $chars[ mt_rand(0, strlen($chars) - 1) ];  
}  
return $str;  
}

?>
